//
//  ViolationInfoCell.m
//  carcareIOS
//
//  Created by ileo on 16/8/2.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "ViolationInfoCell.h"
#import "VioPunishmentView.h"

#define HEIGHT (130)

@interface ViolationInfoCell ()

@property (nonatomic, strong) UILabel *vTimeL;
@property (nonatomic, strong) UILabel *vDetailL;
@property (nonatomic, strong) UILabel *vAddressL;
@property (nonatomic, strong) VioPunishmentView *punishmentView;
@property (nonatomic, strong) UIView *isNewV;

@end

@implementation ViolationInfoCell

+(CGFloat)height{
    return HEIGHT;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.vTimeL = [[UILabel labelWithFrame:CGRectMake(20 * __MAIN_RATIO_375, 15, __MAIN_WIDTH - 50 * __MAIN_RATIO_375, 15) font:FONT_DEFAULT_Light(13) text:nil textColor:COLOR_HEXSTRING(@"#908f8f")] setupOnView:self];
        self.vDetailL = [[UILabel labelWithFrame:CGRectMake(self.vTimeL.left, self.vTimeL.bottom + 14, self.vTimeL.width,self.vTimeL.height) font:FONT_DEFAULT_Bold(16) text:nil textColor:COLOR_HEXSTRING(@"#2a2a2a")] setupOnView:self];
        self.vAddressL = [[UILabel labelWithFrame:CGRectMake(self.vTimeL.left, self.vDetailL.bottom + 9, self.vTimeL.width,self.vTimeL.height) font:FONT_DEFAULT_Light(14) text:nil textColor:COLOR_HEXSTRING(@"#616161")] setupOnView:self];
        
        self.isNewV = [[[[UIView viewWithCenter:CGPointMake(9 * __MAIN_RATIO_375, self.vTimeL.centerY) size:CGSizeMake(6, 6)] resetCornerRadius:3] resetBackgroundColor:COLOR_HEXSTRING(@"#fd6500")] setupOnView:self];
        self.isNewV.hidden = YES;
        [[UIImageView imageViewWithCenter:CGPointMake(__MAIN_WIDTH - 25 * __MAIN_RATIO_375, self.isNewV.centerY) image:ImageNamed(@"cell_right")] setupOnView:self];
        
        [[[UIView viewWithFrame:CGRectMake(0, HEIGHT, __MAIN_WIDTH, 0.5)] resetBackgroundColor:[Theme lineColor]] setupOnView:self];

        self.punishmentView = [[[VioPunishmentView alloc] initWithFrame:CGRectMake(0,  self.vAddressL.bottom, __MAIN_WIDTH, HEIGHT - self.vAddressL.bottom) gap:self.vTimeL.left] setupOnView:self];
        
        [self resetBorderWidth:0.5 borderColor:[Theme lineColor]];
    }
    return self;
}

-(void)setVioModel:(VioModel *)vioModel{
    _vioModel = vioModel;
    self.vTimeL.text = vioModel.showTime;
    self.vDetailL.text = vioModel.detail;
    self.vAddressL.text = vioModel.address;

    [self.punishmentView setPunishmentMoney:vioModel.money point:vioModel.point];
}

#pragma mark -


@end
